package com.gitee.jktantan.datasource.monitor.analyze.entity;

import lombok.Getter;

import java.util.Locale;

/**
 * 直方图实体
 */
@Getter
public class HistogramEntity {

    //计数
    private String count;
    //最小值
    private String min;
    //最大值
    private String max;
    //平均值
    private String mean;

    private String stdDev;
    //中间值
    private String p50;
    //75%值
    private String p75;
    private String p95;
    private String p98;
    private String p99;
    private String p999;

    public void setCount(long count) {
        this.count = String.format(Locale.getDefault(), "%d", count);
    }

    public void setMin(long min) {
        this.min = String.format(Locale.getDefault(), "%d", min);
    }

    public void setMax(long max) {
        this.max = String.format(Locale.getDefault(), "%d", max);
    }

    public void setMean(double mean) {
        this.mean = String.format(Locale.getDefault(), "%2.2f", mean);
    }

    public void setStdDev(double stdDev) {
        this.stdDev = String.format(Locale.getDefault(), "%2.2f", stdDev);
    }

    public void setP50(double p50) {
        this.p50 = String.format(Locale.getDefault(), "%2.2f", p50);
    }

    public void setP75(double p75) {
        this.p75 = String.format(Locale.getDefault(), "%2.2f", p75);
    }

    public void setP95(double p95) {
        this.p95 = String.format(Locale.getDefault(), "%2.2f", p95);
    }

    public void setP98(double p98) {
        this.p98 = String.format(Locale.getDefault(), "%2.2f", p98);
    }

    public void setP99(double p99) {
        this.p99 = String.format(Locale.getDefault(), "%2.2f", p99);
    }

    public void setP999(double p999) {
        this.p999 = String.format(Locale.getDefault(), "%2.2f", p999);
    }
}
